Events have following functions in PTV Drive&Arrive:
Send position with time stamp of a vehicle.
Send update of rest and service times (permanent, following a break, following a driver change)
Set arrived at stop
Set departed from stop
Set stop as canceled
This section contains the base information for every event.
Call to API to trigger an event. The originator can be an OBU (telematic) or a web application (planner).
{ "source": "MYPRODUCT_V2.8", // User defined value that describes the originator of the event. e.g. "mytmsweb", "our_Software", "BestAppV1.2" ... "event": { "eventType": "POSITION", // Type of the event defined in ..ServiceModel\Types\EMEnums.EventType (POSITION, OBUTACHO, STATUS_STOP..) "eventSubtype": "GPS", // The eventSubtype is an optional parameter depending on the eventType. e.g. STATUS_STOP -> ARRIVED "visibility": true, // Visibility of coordinates (true = visible, false = is not visible to dispatcher or ramp ) "scemid": "X9X9X9X9X9", // SCEM-ID on which the event refers to (can be a tour or a stop SCEM-ID) "eventPayLoad": { .... // This eventPayLoad depends on the given eventType. Please refer to the depending descriptions. } } }
The following sections contain only the available eventPayLoads.
validation / message | errorCode |
---|---|
eventSubtype must be GPS for eventType POSITION and OBUTACHO and ARRIVED or DEPARTED for STATUS_STOP | INVALID_EVENTSUBTYPE |
time stamp must be in UTC format, e.g. YYYY-MM-DDThh:mm:ss.0000000+01:00 | TIMESTAMP_INVALID |
Position information has an invalid coordinate format, a geodecimal format is expected. | INVALID_COORDINATE_FORMAT |
SCEM-ID not valid. SCEM-ID should be a 10-digit, case-sensitive, alphanumeric identifier of an existing tour or stop. | SCEMID_INVALID |
Too many source characters. Source parameter is limited to 30 characters. | SOURCE_LENGTH_EXCEEDED |
Tour has expired. Eta will not be refreshed for [<STOP_SCEMID>]* | EVENT_TO_EXPIRED_TOUR |
Maximum allowed tour duration of n days from [YYYY-MM-DDThh:mm:ss.0000000+01:00] has been exceeded.** | TOUR_DURATION_EXCEEDED |
Position information has an invalid speed format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_SPEED_FORMAT |
Position information has an invalid heading format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_HEADING_FORMAT |
Position information has an invalid accuracy format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_ACCURACY_FORMAT |
* A tour is expired if the latest departure time in the stops has already been reached. An event to such a tour stop will result in an error response EVENT_TO_EXPIRED_TOUR and will not be processed
** This error code with message is returned when the actual duration for the tour to complete, is longer than the maximum allowed duration per token. By default, the maximum allowed duration for a tour is set to 7 days.
Some events are skipped without raising an error response. Event requests for example are limited to 1 event per 2 seconds. Any excess events sent within this 2 seconds limit are ignored. However a success response is returned for these requests, and there is also no journal entry for such an event. You can check the meta dictionary of the response, which indicates whether an event is ignored.
{ "responseStatus": { "errorCode": "SUCCESS", "meta": { "SKIPPED_OVERUSE": "An event with SCEMID X9X9X9X9X9 has already been received 2s ago. This event will not be processed." } } }
validation / message | meta code |
---|---|
An event with SCEMID X9X9X9X9X9 has already been received 2s ago. This event will not be processed. | SKIPPED_OVERUSE |
Received event with SCEMID X9X9X9X9X9 is duplicate and will not be processed. | SKIPPED_DUPLICATE |
Received event with SCEMID X9X9X9X9X9 is older than last event and will not be processed. | SKIPPED_OBSOLETE |
If you do not know to which stop of the multi-stop tour you want to send your position to or just want to use the automatic detection of states (APPROACHING, ARRIVED, DEPARTED), you can send the positions using the tour-SCEMID. In this case, Drive&Arrive will predict to which stop the driver is driving currently and manage all the stop states automatically without any further interaction.
Will be sent by telematics or from PTV Drive&Arrive iOS or Android Driver App 1.x to transmit current position of truck.
{ "source": "MYPRODUCT_V2.8", // User defined value that describes the originator of the event. e.g. "mytmsweb", "our_Software", "BestAppV1.2" ... "event": { "eventType": "POSITION", // Type of the event POSITION "eventSubtype": "GPS", // optional: for eventType POSITION it can be GPS or NETWORK etc. "visibility": true, // Visibility of coordinates (true = visible, false = is not visible to dispatcher or ramp ) "scemid": "X9X9X9X9X9", // SCEM-ID on which the event refers to (can be a tour or a stop SCEM-ID) "eventPayLoad": { "coordinate": { // LatLon of a geographic position in WGS84 "locationX": 8.61656234754918, // longitude of coordinate in WGS 84, e.g. 13.4261419 for Berlin / mandatory "locationY": 49.8182790029665 // latitude of coordinate in WGS 84, e.g. 52.5075419 for Berlin / mandatory }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000+01:00" // time stamp of event generation on side of the event sender in UTF-Format "heading": 360, // optional: degree (0=North 90=East 0-360), use 360 for 0 deg "accuracy": 0.0, // optional: accuracy in meter "speed": 0.0 // optional: meter/seconds, 0.0 = no speed } } }
ETA notification is generated on refreshed ETA information. See: ETA Calculation Interval
ETA notification has following format:
{ "notificationContentType": "ETA_INFO", "notificationPayLoad": [ { "estimatedTime": "2013-03-07T19:57:17.0000000+01:00", "scemid": "X9X9X9X9X9" // always a stop SCEM-ID } ] }
ETA notification creates following entry in the journal:
{ "ts": "YYYY-MM-DDThh:mm:ss.0000000+01:00", "journalType": "ETA_INFO", "description": "ETA info", "entry": "{\"scemid\":\"X9X9X9X9X9\",\"planned\":\"YYYY-MM-DDThh:mm:ss.0000000+01:00\",\"refroute\":\"YYYY-MM-DDThh:mm:ss.0000000+01:00\",\"estimated\":\"YYYY-MM-DDThh:mm:ss.0000000+01:00\",\"notification\":false}", "scemid": "X9X9X9X9X9" }
ETA tolerance will be stored internally.
Creates an entry in the journal with the following format:
{ "ts": "2014-07-03T07:45:40.6244201+01:00", "journalType": "EVENT_CREATED", "description": "Position", "entry": "{\"eventType\":\"POSITION\",\"eventSubtype\":\"GPS\",\"visibility\":true,\"eventPayLoad\":{\"heading\":360,\"coordinate\":{\"locationX\": 8.61656234754918,\"locationY\": 49.8182790029665},\"timeStamp\":\"YYYY-MM-DDThh:mm:ss.000+01:00\",\"heading\": 360, \"accuracy\": 0.0, \"speed\": 0.0},\"scemid\":\"X9X9X9X9X9\"}", "scemid": "X9X9X9X9X9", "source": "MYPRODUCT_V2.8" }
Heading set to 0 will be ignored for ETA calculation. Use 360 instead of 0 if it is intended.
Will be sent by OBU via TMS to transmit position as well as current rest and service times concerning break or driver change.
{ "source": "MYPRODUCT_V2.8", // User defined value that describes the originator of the event. e.g. "mytmsweb", "our_Software", "BestAppV1.2" ... "event": { "eventType": "OBUTACHO", // Type of the event OBUTACHO "eventSubtype": "GPS", // optional: for eventType OBUTACHO it can be GPS or NETWORK etc. "visibility": true, // Visibility of coordinates (true = visible, false = is not visible to dispatcher or ramp ) "scemid": "X9X9X9X9X9", // SCEM-ID on which the event refers to (can be a tour or a stop SCEM-ID) "eventPayLoad": { "driverReference": "driver 1", // optional: driver information depending of the provider "raSTime": { // rest and service time information "periodDrivenSinceLastBreak": 0, // The amount of time the driver has spent operating the vehicle since the last break "periodDrivenSinceLastRest": 0, // The amount of time the driver has spent operating the vehicle since the last rest "currentIdlePeriod": 0, // The amount of time the driver has spent idle right before the reference time "isSplitBreak": false, // True if the driver has already completed the first part of his split break. Since then he has operated his vehicle or performed active service. "isSplitRest": false // True if the driver has already completed the first part of his split rest. Since then he has operated his vehicle or performed active service. }, "coordinate": { // LatLon of a geographic position in WGS84 "locationX": 8.61656234754918, // longitude of coordinate in WGS 84, e.g. 13.4261419 for Berlin / mandatory "locationY": 49.8182790029665 // latitude of coordinate in WGS 84, e.g. 52.5075419 for Berlin / mandatory }, "timeStamp": "2013-03-07T10:00:00.000+01:00" // time stamp of event generation on side of the event sender in UTF format "heading": 360, // optional: degree (0=North 90=East 0-360), use 360 for 0 deg "accuracy": 0.0, // optional: accuracy in meter "speed": 0.0 // optional: meter/seconds, 0.0 = no speed } } }
If last OBUTACHO Event with rest and service times triggers a new ETA calculation, an ETA notification is generated. See: ETA Calculation Interval
Rest and service times will be stored up to new ones to calculate an ETA based on rest and service times.
If no raSTime information is sent in eventPayLoad, such OBUTacho event will be handled as a POSITION event.
Creates an entry in the journal with the following format:
{ "ts": "YYYY-MM-DDThh:mm:ss.0000000+00:00", "journalType": "EVENT_CREATED", "description": "Create Event", "entry": "{\"eventType\":\"OBUTACHO\",\"eventSubtype\":\"GPS\",\"visibility\":true,\"eventPayLoad\":{\"driverReference\":"\driver1"\,\"raSTime\": {\"periodDrivenSinceLastBreak\": 0, \"periodDrivenSinceLastRest\": 0, \"currentIdlePeriod\": 0, \"isSplitBreak\": false, \"isSplitRest\": false },\"coordinate\":{\"locationX\": 8.000,\"locationY\": 49.000},\"timeStamp\":\"YYYY-MM-DDThh:mm:ss.000+01:00\"},\"scemid\":\"X9X9X9X9X9\"}", "scemid": "X9X9X9X9X9", "source": "MYPRODUCT_V2.8" }
This API call allows users to send multiple events belonging to a same tour or to stops in a same tour. Events can be of any existing eventType. The originator can be an OBU (telematic) or any web/mobile application.
This API call can be made by calling https://driveandarrive-v1.cloud.ptvgroup.com/em/event/batch?source=myproduct_v2.8
Example POST data:
{ "events": [ { "eventType": "POSITION", "eventSubtype": "GPS", "visibility": true, "eventPayLoad": { "heading": 18.43496718915071, "coordinate": { "locationX": 7.482548394, "locationY": 51.466587636 }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000+01:00" }, "scemid": "X9X9X9X9X9" }, { "eventType": "POSITION", "eventSubtype": "GPS", "visibility": true, "eventPayLoad": { "heading": 353.99098752334834, "coordinate": { "locationX": 7.4806452506, "locationY": 51.470305967 }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000+01:00" }, "scemid": "X9X9X9X9X9" }, { "eventType": "STATUS_STOP", "eventSubtype": "SUSPENDED", "visibility": true, "eventPayLoad": { "heading": 326.3100829908429, "coordinate": { "locationX": 7.4793476529, "locationY": 51.480220034 }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000+01:00" }, "scemid": "X9X9X9X9X9" } ] }
Note: Only the last event of eventType POSITION in this call will trigger ETA calculation, if the last ETA calculation period has been expired.
validation / message | errorCode |
---|---|
eventSubtype must be GPS for eventType POSITION and OBUTACHO and ARRIVED or DEPARTED for STATUS_STOP. | INVALID_EVENTSUBTYPE |
time stamp must be in UTC format, e.g. YYYY-MM-DDThh:mm:ss.0000000+01:00 | TIMESTAMP_INVALID |
Position information has an invalid coordinate format, a geodecimal format is expected. | INVALID_COORDINATE_FORMAT |
SCEM-ID not valid. SCEM-ID should be a 10-digit, case-sensitive, alphanumeric identifier of an existing tour or stop. | SCEMID_INVALID |
Too many source characters. Source parameter is limited to 30 characters. | SOURCE_LENGTH_EXCEEDED |
Tour has expired. Eta will not be refreshed for [<STOP_SCEMID>]* | EVENT_TO_EXPIRED_TOUR |
Maximum allowed tour duration of n days from [YYYY-MM-DDThh:mm:ss.0000000+01:00] has been exceeded.** | TOUR_DURATION_EXCEEDED |
Only events to stops belonging to a single tour is allowed. | EVENTS_TO_MULTIPLE_TOURS |
Position information has an invalid speed format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_SPEED_FORMAT |
Position information has an invalid heading format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_HEADING_FORMAT |
Position information has an invalid accuracy format, a geodecimal format is expected. | INVALID_EVENTPAYLOAD_ACCURACY_FORMAT |
DriveAndArrive API allows users to set certain status to a stop. This can be used to inform a dispatcher or provide customer specific requirements for a specific stop.
Status can be sent from a driver (with coordinate) or from a dispatcher (without coordinate).
Status events do not trigger ETA calculation.
{ "event": { "eventType": "STATUS_STOP", // Type of the event STATUS_STOP "eventSubtype": "ARRIVED", // The eventSubtype is a MANDATORY parameter, APPROACHING / ARRIVED / DEPARTED / SUSPENDED / CANCELLED for STATUS_STOP "visibility": true, // Visibility of coordinates (true = visible, false = is not visible to dispatcher or ramp) "scemid": "X9X9X9X9X9", // SCEM-ID on which the event refers to (only Stop SCEM-ID) "eventPayLoad": { "timeStamp": "2013-03-07T10:00:00.000+01:00"// timestamp of event generation on side of the event sender in UTF-format "addInfo": "User defined comment", // comment of sender: I'm 10 minutes late because of some reason at stop X "coordinate": { // LatLon of a geographic position in WGS84 "locationX": 8.61656234754918, // longitude of coordinate in WGS 84, e.g. 13.4261419 for Berlin / mandatory "locationY": 49.8182790029665 // latitude of coordinate in WGS 84, e.g. 52.5075419 for Berlin / mandatory } } } }
Here, the eventType must be set to STATUS_STOP and the eventSubType should be one of the predefined states.
Drive&Arrive defines 5 such states (stop status):
Approaching indicates the currently driving to stop.
Approaching status is set to a stop on the first event to the stop or if the stop is already suspended with status SUSPENDED.
Creates an entry in the journal with the following format:
{ "eventType": "STATUS_STOP", "eventSubtype": "APPROACHING", "visibility": true, "action": "NONE", "eventPayLoad": { "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", "addInfo": "...", "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" } }, "scemid": "X9X9X9X9X9", "source": "event_source" }
Creates following notification if the stop is subscribed
{ "notificationContentType": "STOP_APPROACHING", "topicType": "ETA", "notificationPayLoad": [ { "coordinate": { "locationX": 8.517174, "locationY": 49.108872 }, "timeStamp": "2017-10-24T07:12:57+00:00", "scemid": "XXYYZZYYYY" } ], "subscriptionID": "7a157f19684a46e5b071a8160076aa10" }
Arrived status indicates that the stop is reached.
Creates a notification with the following format:
{ "notificationContentType": "STOP_ARRIVED", "topicType": "ETA", "notificationPayLoad": [ { "addInfo": "...", // additional info "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", // time of STATUS_STOP -> CANCELLED event sent "scemid": "X9X9X9X9X9" // stop being suspended with event sent } ], "subscriptionID": "00000000000000000000000000000000" // subcription id to which this notification will be sent }Notification is equal to TA (time of arrival). TA can be used for quality checks.
Creates an entry in the journal with the following format:
{ "eventType": "STATUS_STOP", "eventSubtype": "ARRIVED", "visibility": true, "action": "NONE", "eventPayLoad": { "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", "addInfo": "...", "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" } }, "scemid": "X9X9X9X9X9", "source": "event_source" }
Departed status on a stop, indicates that the driver has left the stop that was arrived before.
Departed status usually follows after the arrived status on a stop.
Departed status to a stop is advised, if the delivery was successful at the stop. If the driver intends to come back to the stop again, one should set the status SUSPENDED to the stop.
Creates a notification with the following format:
{ "notificationContentType": "STOP_DEPARTED", "topicType": "ETA", "notificationPayLoad": [ { "addInfo": "...", // additional info "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", // time of STATUS_STOP -> CANCELLED event sent "scemid": "X9X9X9X9X9" // stop being suspended with event sent } ], "subscriptionID": "00000000000000000000000000000000" // subcription id to which this notification will be sent }Notification is equal to TA (time of arrival). This can be used to check departure on time.
Creates an entry in the journal with the following format:
{ "eventType": "STATUS_STOP", "eventSubtype": "DEPARTED", "visibility": true, "action": "NONE", "eventPayLoad": { "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", "addInfo": "...", "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" } }, "scemid": "X9X9X9X9X9", "source": "event_source" }
SUSPENDED indicates a paused stop and allows the driver to send position to the stop again to continue driving to it.
SUSPENDED status automatically changes to APPROACHING, if position event is received to a suspended stop.
Creates a notification in the following format:
{ "notificationContentType": "STOP_SUSPENDED", "topicType": "ETA", "notificationPayLoad": [ { "addInfo": "...", // additional info "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", // time of STATUS_STOP -> SUSPENDED event sent "scemid": "X9X9X9X9X9" // stop being suspended with event sent } ], "subscriptionID": "00000000000000000000000000000000" // subscription id to which this notification will be sent }
Creates an entry in the journal with the following format:
{ "eventType": "STATUS_STOP", "eventSubtype": "SUSPENDED", "visibility": true, "action": "NONE", "eventPayLoad": { "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", "addInfo": "...", "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" } }, "scemid": "X9X9X9X9X9", "source": "MYPRODUCT_V2.8" }
Cancelled status is set to a stop, to skip the stop for ETA calculation. This status is necessary if the stop is removed from the tour or not necessary to reach anymore.
Creates a notification in the following format:
{ "notificationContentType": "STOP_CANCELLED", "topicType": "ETA", "notificationPayLoad": [ { "addInfo": "...", // additional info "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" }, "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", // time of STATUS_STOP -> CANCELLED event sent "scemid": "X9X9X9X9X9" // stop being suspended with event sent } ], "subscriptionID": "00000000000000000000000000000000" // subscription id to which this notification will be sent }
Creates an entry in the journal with the following format:
{ "eventType": "STATUS_STOP", "eventSubtype": "CANCELLED", "visibility": true, "action": "NONE", "eventPayLoad": { "timeStamp": "YYYY-MM-DDThh:mm:ss.000000+00:00", "addInfo": "...", "coordinate": { "locationX": "7.4406359857", "locationY": "51.529677327" } }, "scemid": "X9X9X9X9X9", "source": "MYPRODUCT_V2.8" }
Drive&Arrive sets various STATUS described above to the executing tour stops, depending on various conditions. These conditions may relate to
The STATUS Approaching, Departed, Suspended will be set automatically by Drive&Arrive, if not set by the user (Driver).
Approaching STATUS is set to a stop automatically by D&A, if a position event is received to the stop and in following conditions:
Departed STATUS is set to a stop automatically by D&A, if a position event is received to the stop and in following conditions:
Suspended STATUS is set to a stop automatically by D&A, if a position event is received for another stop in the tour and
The diagram below shows how a status should be used in Drive and Arrive and the correct flow from one status to another. It also shows how some status are generated automatically from Drive and Arrive on different conditions.
© 2022 PTV Planung Transport Verkehr GmbH | Imprint